from PyQt6.QtCore import QObject, pyqtSignal

class SignalEmitter(QObject):
    # 定义一个无参数信号
    basic_signal = pyqtSignal()
    
    def trigger_signal(self):
        print("准备发射信号...")
        self.basic_signal.emit()

class SlotReceiver(QObject):
    def handle_signal(self):
        print("接收到信号！")

# 使用示例
emitter = SignalEmitter()
receiver = SlotReceiver()

# 连接信号与槽
emitter.basic_signal.connect(receiver.handle_signal)

# 触发信号
emitter.trigger_signal()
